package negModel;

import negModelExcep.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public abstract class Parte {

	private int maxVU; 
	private int vidaUtil;
	private double peso;
	private float aportevmax;
	private String detalle;
	private AlgoPesos precio;
	private boolean removible;
	
	public boolean esRemovible(){
		return removible;
	}
	
	public void setRemovible(boolean sn){
		this.removible=sn;
	}
	
	public void setDetalle(String detalle){
		this.detalle = detalle;
	}
	
	public String getDetalle(){
		return this.detalle;
	}
	
	public void setPrecio(AlgoPesos precio){
		this.precio = precio;
	}
	
	public AlgoPesos getPrecio(){
		return this.precio;
	}
				
	public void setMaxVU (int Max){
		this.maxVU=Max;
	}
	
	public int getMaxVU (){
		return this.maxVU;
	}
	
	public int getVidaUtil(){
		return this.vidaUtil;
	}
	
	public void setVidaUtil (int V){
		this.vidaUtil+=V;
	}
	
	public AlgoPesos getCostoDeArreglo(){
		return new AlgoPesos(this.maxVU-this.vidaUtil);
	}
	
	public void arreglar(){
		this.vidaUtil=this.maxVU;
	}
	
	public void setPeso(double P){
		this.peso=P;
	}
	
	public double getPeso(){
		return this.peso;
	}
		
	public void setAportevmax(float avm){
		this.aportevmax = avm;
	}
	
	public float aportevmax(){
		return aportevmax;
	}
	
	public void gastar() throws eParteNoFunciona{
		if (this.getVidaUtil() <= 0)
			throw new eParteNoFunciona(this);
		this.setVidaUtil(-1);
	}	
	
	public abstract double funcionar() throws eParteNoFunciona;
	
	public abstract void agregarMejora(Vehiculo v);
	
	public abstract void sacarMejora(Vehiculo v);
	
	public abstract Element toXml(Document doc);
		
	
}
